<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/2/10
 * Time: 13:07
 */

namespace Home\Controller;


class KeywordController extends HomeController
{
     public function index(){
        if(IS_POST){
           $keyword=I("post.keyword","","addslashes");
           $map['status']=1;
           $map['title']=array("like","%".$keyword."%");
           $order="level desc,id desc";
           $document=M("document");
           $news_list=$document->where($map)->order($order)->select();
            //print_r($news_list);exit;
           $this->assign("news_list",$news_list);
           $this->assign("meta_title","搜索关键字");
           $this->display();

        }
     }
    public function detail(){
        $id=I("get.id",0,"int");
        $document=D("Document");
        $data_detail=$document->detail($id);
        $this->assign("data_detail",$data_detail);
        $this->assign("meta_title","搜索关键字");
        $this->display();
    }
}